package collection;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class SortString {
    public static void main(String[] args) {
        List<String> a = new ArrayList<>();
        a.add("Tom");
        a.add("Jerry");
        a.add("Mike");
        a.add("Lucy");
        System.out.println(a);

        Collections.sort(a);
        System.out.println("排序后："+a);

        Collections.sort(a, (o1, o2) -> o2.length()-o1.length());
        System.out.println("升序排序后："+a);
    }
}
